//
//  OnSaleTableViewCell.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/10.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "OnSaleTableViewCell.h"

@implementation OnSaleTableViewCell
{
    GLGWLabel * storeLabel;
    GLGWLabel * goodslabel;
    GLGWLabel * specLabel;
    GLGWLabel * moneyLabel;
    GLGWLabel * numberlabel;
    GLGWLabel * timeLab;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setSepartionLineWith:lineModel_All];
        //
        storeLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(10), KScreenWidth - kWidthProportion_In_iPhoneTriploid(30), kHeightProportion_In_iPhoneTriploid(17)) theFont:SYSTEMFONT(12) theColor:kColor_Rule_Black inSuperView:self];
        [storeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(@(kHeightProportion_In_iPhoneTriploid(11)));
            make.left.equalTo(@(kWidthProportion_In_iPhoneTriploid(15)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        NSString *str = @" 小张店铺";
        storeLabel.backgroundColor = kRandomColor;
        storeLabel.attributedText = [GLGWLabel addImageName:@"search_sale" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:str atImageIndex:0];
        
        goodslabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kY_With_View(storeLabel, 10), storeLabel.width, kHeightProportion_In_iPhoneTriploid(20)) theFont:SYSTEMFONT(14) theColor:kColor_Rule_Black inSuperView:self];
        goodslabel.text = @"三级螺纹钢 HRB400E 河钢";
        goodslabel.backgroundColor = kRandomColor;
        //
        specLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(goodslabel.x, kY_With_View(goodslabel, 9), goodslabel.width, kHeightProportion_In_iPhoneTriploid(17)) theFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self];
        specLabel.text = @"φ6*12";
        specLabel.backgroundColor = kRandomColor;
        //
        moneyLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(specLabel.x, kY_With_View(specLabel, 10), kWidthProportion_In_iPhoneTriploid(200), kHeightProportion_In_iPhoneTriploid(22)) theFont:SYSTEMFONT(16) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:self];
        moneyLabel.backgroundColor = kRandomColor;
        moneyLabel.text = @"¥3845";
        //
        numberlabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self.contentView];
        numberlabel.text= @"2000吨";
        numberlabel.backgroundColor = kRandomColor;
        [numberlabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(14));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        
        timeLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self.contentView];
        timeLab.text= @"2018-07-10 13:23:56";
        timeLab.backgroundColor = kRandomColor;
        [timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(self->storeLabel.mas_centerY);
            make.left.equalTo(self->storeLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(5));
        }];
        timeLab.textAlignment = NSTextAlignmentRight;
    }
    return self;
}

- (void)setType:(OnSaleCellType)type
{
    _type = type;
    if (type == OnSaleCellType_Order) {
        timeLab.hidden = YES;
    }
    
}

@end
